package forList;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class CollectionTest {

    public static void main(String[] args) {

        Collection<Object> list = new ArrayList<>();
        list.add("hello");
        list.add('a');
        list.add(1);
        Iterator<Object> iterator = list.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
        for (Object o : list) {
            System.out.println(o);
        }
    }

}
